package com.kay.web;

import javax.servlet.ServletContainerInitializer;
import javax.servlet.ServletContext;
import java.util.Set;

/**
 * @Description:
 *  调用 MyWebApplicationInitializer 的 onstartup
 *
 * @Author: Kay
 * @CreateDate: 2021/7/26$ 21:01$
 * @UpdateUser: Kay
 * @UpdateDate: 2021/7/26$ 21:01$
 */
public class MySpringServletContainerInitializer implements ServletContainerInitializer {

    public void onStartup(Set<Class<?>> set, ServletContext servletContext){
        // 获得项目中所有实现WebApplicationInitializer接口的实现类了，在onStart方法中的第一个set集合参数中就是所有实现类的集合
        // 此处采用简单的方式 通过 new MyWebApplicationInitializer 对象的形式调用其onStartup方法
        System.out.println(" MySpringServletContainerInitializer  ...... ");
        MyWebApplicationInitializer myWebApplicationInitializer = new MyWebApplicationInitializer();
        myWebApplicationInitializer.onStartup(servletContext);
    }
}
